package com.woniuxy.caradmin.service.impl;

import com.woniuxy.caradmin.entity.pojo.Maintainrecord;
import com.woniuxy.caradmin.entity.vo.MaintainrecordVo;
import com.woniuxy.caradmin.mapper.MaintainrecordMapper;
import com.woniuxy.caradmin.service.MaintainrecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author womenzu
 * @since 2020-12-07
 */
@Service
public class MaintainrecordServiceImpl implements MaintainrecordService {
    @Autowired
    private MaintainrecordMapper maintainrecordMapper;

    @Override
    public List<Maintainrecord> selectAllMaintainRecord(MaintainrecordVo maintainrecordVo) {
        return maintainrecordMapper.selectAllMaintainRecord();
    }

    @Override
    public List<Maintainrecord> selectMaintainRecordByVid(String vehiclenum) {
        return maintainrecordMapper.selectMaintainRecordByVid(vehiclenum);
    }

    @Override
    public int addMaintainRecord(Maintainrecord maintainrecord) {
        return maintainrecordMapper.addMaintainRecord(maintainrecord);
    }

    @Override
    public int updateMaintainRecord(Maintainrecord maintainrecord) {
        return maintainrecordMapper.updateMaintainRecord(maintainrecord);
    }
    //1 分页查询
    @Override
    public List<Maintainrecord> selectAllBy(MaintainrecordVo maintainrecordVo) {
        return maintainrecordMapper.selectAllBy(maintainrecordVo);
    }

    //2 批量删除
    @Override
    public boolean deleteMaintainRecord(Integer[] ids) {
        if (ids != null && ids.length > 0 ){
            for (Integer id :ids){
                maintainrecordMapper.deleteMaintainRecord(id);
            }
            return true;
        }
        return false;
    }

    @Override
    public Maintainrecord maintainRecordById(Integer id) {
        return maintainrecordMapper.maintainRecordById(id);
    }

    @Override
    public Maintainrecord selectMaintainrecordById2(Integer id) {
        Maintainrecord maintainrecord = maintainrecordMapper.selectMaintainrecordById2(id);
        return maintainrecord;
    }
}
